﻿namespace GoodAdmin.System;

/// <summary>
/// 组织服务
/// </summary>
public interface ISysOrgService
{
    /// <summary>
    /// 获取所有组织列表
    /// </summary>
    /// <returns></returns>
    Task<List<SysOrg>> GetOrgList();

    Task<List<SysOrg>> GetOrgTree(List<long>DataScope=null);

    /// <summary>
    /// 分页查询组织列表
    /// </summary>
    /// <param name="input"></param>
    /// <returns></returns>
    Task<SqlSugarPagedList<SysOrg>> GetOrgPageList(OrgPageInput input);
    /// <summary>
    /// 根据组织id获取组织明细
    /// </summary>
    /// <param name="OrgId"></param>
    /// <returns></returns>
    Task<SysOrg> GetOrgDetail(long OrgId);

    /// <summary>
    /// 新增
    /// </summary>
    /// <param name="input"></param>
    /// <returns></returns>
    Task AddOrg(OrgAddInput input);

    /// <summary>
    /// 更新
    /// </summary>
    /// <param name="input"></param>
    /// <returns></returns>
    Task UpdateOrg(OrgUpdateInput input);

    /// <summary>
    /// 根据组织Id删除
    /// </summary>
    /// <param name="input"></param>
    /// <returns></returns>
    Task DeleteOrg(BaseIdInput input);

    /// <summary>
    /// 获取当前组织的所有下级列表(非树形)
    /// </summary>
    /// <param name="OrgId">当前组织Id</param>
    /// <param name="isContainSelf">是否包含自己</param>
    /// <returns></returns>
    Task<List<SysOrg>> GetOrgChildrenList(long OrgId,bool isContainSelf=true);

    /// <summary>
    /// 获取当前组织的所有下级组织Id列表
    /// </summary>
    /// <param name="OrgId">当前组织Id</param>
    /// <param name="isContainSelf">是否包含自己</param>
    /// <returns></returns>
    Task<List<long>> GetOrgChildrenIdList(long OrgId, bool isContainSelf = true);

    /// <summary>
    /// 部门是否存在
    /// </summary>
    /// <param name="orgId"></param>
    /// <returns></returns>
    Task<bool> IsOrgExist(long orgId);

    /// <summary>
    /// 构造组织树形列表
    /// </summary>
    /// <param name="orgList"></param>
    /// <returns></returns>
    List<SysOrg> ConstructOrgTree(List<SysOrg> orgList);
}
